/**
 * 功能:TK_PERSONS Dao类
 * 开发人员:chengd
 * 创建时间:2012/10/15 21:39:27
 */
package com.towker.frame.dao.basicData;

import java.util.HashMap;
import java.util.Map;

import org.springframework.stereotype.Repository;
import com.towker.core.db.BaseDao;
import com.towker.frame.model.basicData.Person;

@Repository
@SuppressWarnings("unchecked")
public class PersonDao extends BaseDao<Person, Long>
{
	@Override
	public Class getEntityClass()
	{
		return Person.class;
	}
	
	public boolean checkExistsCode(String person_code, Integer id) {
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("person_code", person_code);
		if (id != null & id > 0) {
			map.put("id", id);
		}
		Integer totalCount = (Integer) this.getSqlSessionTemplate().selectOne(getIbatisMapperNamespace() + ".checkExistsCode", map);
		if (totalCount == null) {
			return false;
		} else {
			return totalCount > 0;
		}
	}
}